package com.jr.Service.Impl;

import com.jr.Dao.IProjectInfoDao;
import com.jr.Dao.Impl.IProjectInfoDaoImpl;
import com.jr.Service.IProjectInfoService;
import com.jr.pojo.ProjectInfo;
import com.jr.util.PageHelper;

import java.util.ArrayList;

public class IProjectInfoServiceImpl implements IProjectInfoService {
    IProjectInfoDao ipd = new IProjectInfoDaoImpl();

    @Override
    public ProjectInfo queryByPid(Integer pid) {
        ArrayList<ProjectInfo> projectInfos = ipd.selectByPid(pid);
        if(projectInfos.size()>0){
            return projectInfos.get(0);
        }else{
            return null;
        }
    }

    @Override
    public boolean updateProjectInfo(ProjectInfo projectInfo) {
        return ipd.updateProjectInfo(projectInfo)>0;
    }

    @Override
    public int queryDataCount(Integer status) {
        return ipd.selectDataCount(status);
    }

    @Override
    public ArrayList<ProjectInfo> queryByStatus(Integer status, PageHelper ph) {
            return ipd.selectByStatus(status,ph);
    }
}
